/**
 * www.lifexx.com Inc.
 * Copyright (c) 2014 All Rights Reserved.
 */
package net.mikoo.seals.boss.biz.mapper.boss;

import java.util.List;

import org.apache.ibatis.annotations.Param;
import org.mybatis.spring.annotation.MapperScan;

import net.mikoo.seals.boss.model.Menu;
import net.mikoo.seals.boss.model.RolePermit;

/**
 *                       
 * @Filename RolePermitMapper.java
 *
 * @Description 
 *
 * @Version 1.0
 *
 * @Author chenzx
 *
 * @Email chenzx1206@163.com
 *       
 * @History
 *<li>Author: chenzx</li>
 *<li>Date: 2015年1月27日</li>
 *<li>Version: 1.0</li>
 *<li>Content: create</li>
 *
 */
@MapperScan
public interface RolePermitMapper {
	/**
	 * 添加
	 * 
	 * @param rolePermit
	 * @return
	 */
	public Integer insert(RolePermit rolePermit);

	/**
	 * 删除
	 * 
	 * @param copyFromId
	 * @return
	 */
	public Integer deleteByRoleId(Long roleId);
	
	/**
	 * 删除
	 * 
	 * @param copyFromId
	 * @return
	 */
	public Integer deleteByMenuId(Long menuId);
	
	/**
	 * 查询
	 * 
	 * @param roleId
	 * @return
	 */
	public List<RolePermit> selectByRoleId(Long roleId);
	
	/**
	 * 更新
	 * 
	 * @param rolePermit
	 * @return
	 */
	public Long updateByRoleIdAndMenuId(RolePermit rolePermit);
	
	/**
	 * 更新
	 * 
	 * @param roleId
	 * @return
	 */
	public Long updateByRoleId(Long roleId);

	/**
	 * 查询当事人拥有的资源
	 * @param partyId
	 * @return
	 */
	public List<Menu> selectHaveResource(Long partyId);

	public List<Menu> selectRootResource(Long partyId);

	public List<Menu> loadSubResource(@Param("partyId")Long partyId, @Param("parentId")Long parentId);

	/**
	 * 查询角色所拥有的资源
	 * @param roleId
	 * @return
	 */
	public List<Menu> selectResourceByRoleId(Long roleId);
}
